<?php
/**
 * Created by 日志观察者.
 * User: 楚羽幽
 * Date: 2018/2/8
 * Time: 0:38
 * QQ：1113581489
 */
namespace app\common\logic\observer\logic;
use think\Db;

class Adminlog implements \SplObserver
{
    //预设结果集
    private $data;
    //执行结果
    private $bool = false;

    //构造函数
    public function __construct($data = [])
    {
        $this->data = $data;
    }

    //获取结果集
    public function GetData()
    {
        return $this->data;
    }

    //更新操作
    public function update(\SplSubject $subject)
    {
        if (!empty($this->data))
        {
            if (Db::name('adminlog')->insert($this->data))
            {
                $this->bool = true;
            }
        }
    }

    //返回执行结果
    public function CallbackExec()
    {
        return $this->bool;
    }
}